<template>
  <el-dialog
    :title="title"
    :visible.sync=showDialog
    @close="callbackFunc(false)"
    :modal="false"
    :append-to-body="false"
  >
    <template v-if="containAco">
      <div style="margin-bottom: 10px">
        所选的广告包含程序化创意(ACO)。如果所有广告均保持投放状态，则ACO推广系列的效果会更好。你确定要暂停广告吗?
      </div>
    </template>
    <el-table :data="dataList" max-height="400px">
      <el-table-column prop="adName">
        <template slot-scope="{row}">
          {{row.adName}}<i style="color: red">{{row.creativeMaterialMode === 'DYNAMIC'?'(ACO)':''}}</i>
        </template>
      </el-table-column>
    </el-table>
    <div style="text-align: right;margin: 10px;">
      <el-button type="primary" @click="callbackFunc(true)">确 定</el-button>
      <el-button @click="callbackFunc(false)">取 消</el-button>
    </div>
  </el-dialog>
</template>
<script>
  import _ from "lodash";

  export default {
    name: "BatchAdConfirm",
    props: {
      dataList: {
        type: Array
      },
      visible: {
        type: Boolean,
        default: false
      },
      title: {
        type: String,
        default: ""
      },
      containAco: {
        type: Boolean,
        default: false
      },
      status: String
    },
    computed: {
      showDialog: {
        get() {
          return this.visible
        },
        set(val) {
          this.$emit('update:visible',val)
        }
      }
    },
    data(){
      return {}
    },
    methods: {
      callbackFunc(confirm){
        let data = _.cloneDeep(this.dataList)
        let status = _.cloneDeep(this.status)
        this.$emit("callbackBatchAdOps", confirm, data, status)
        this.showDialog = false
      }
    }
  }
</script>
